package org.ohos.sample.cordova;

import ohos.agp.components.webengine.BrowserAgent;
import ohos.agp.components.webengine.WebView;
import ohos.app.Context;

public class SystemBrowserAgent extends BrowserAgent {
    private String TAG="SystemBrowserAgent";
    private WebViewInterface webViewInterface;
    public SystemBrowserAgent(Context context,WebViewInterface webViewInterface) {
        super(context);
        this.webViewInterface = webViewInterface;
    }

    @Override
    public void onTitleUpdated(WebView webView, String title) {
        super.onTitleUpdated(webView, title);
        // 标题变更时自定义处理
    }

    @Override
    public void onProgressUpdated(WebView webView, int newProgress) {
        super.onProgressUpdated(webView, newProgress);
        // 加载进度变更时自定义处理
        if(webViewInterface!=null){
            webViewInterface.onWebViewProgressUpdated(newProgress );
        }
    }
}
